package com.gl.codewar.template;

public class RedundantAcronymSyndrome {

	public static String format(String str) {
		String d="";
                String[] filas =str.split("\n");
                
                for (int j = 0; j < filas.length; j++) {
                    if(filas[j].trim()=="END"){
                        break;
                    }
                    
                    String lastword=filas[j].split(" ")[filas[j].split(" ").length-1];
                    for (int k = 0; k < filas[j].split(" ").length; k++) {
                        d+=(filas[j].split(" "))[k].toUpperCase().charAt(0) ;
                    }
                    d+=" "+lastword+"\n";
                }
                
                System.out.print(d.substring(0, d.length()-7));
                
                
		return d.substring(0, d.length()-7) + "\n";
	}

}
